﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CMS.Domain
{
    public class CMSDbContext : DbContext
    {
        public CMSDbContext()
            :base("name=cms-db")
        {
            Database.SetInitializer<CMSDbContext>(null);
        }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);

            modelBuilder.Entity<Entities.EArticle>().ToTable("cms_article");
            modelBuilder.Entity<Entities.EArticle>().HasKey(p => p.Id);

            modelBuilder.Entity<Entities.ESeed>().ToTable("cms_seed");
            modelBuilder.Entity<Entities.ESeed>().HasKey(p => p.Id);

            modelBuilder.Entity<Entities.EMedia>().ToTable("cms_media");
            modelBuilder.Entity<Entities.EMedia>().HasKey(p => p.Id);
        }
    }
}
